// part1:C14:14.26:my_String.h
#ifndef MY_STRING_H__
#define MY_STRING_H__
#include <iostream>
#include <string>
class String
{
public:
    String();
    String(const char *str): str(str){}
    ~String(){}
    friend bool operator==(const String &lhs, const string &rhs);
    friend bool operator!=(const String &lhs, const string &rhs);
    friend bool operator<(const String &lhs, const string &rhs);
    friend bool operator<=(const String &lhs, const string &rhs);
    friend bool operator>(const String &lhs, const string &rhs);
    friend bool operator>=(const String &lhs, const string &rhs);
    char& operator[](std::size_t n)
    {
        return (char)str[n];
    }
    const char& operator[](std::size_t n) const
    {
        return (char)str[n];
    }
private:
    const char *str;
};

bool operator==(const String &lhs, const string &rhs)
{
    return strcmp(lhs.str, rhs.str);
}
bool operator!=(const String &lhs, const string &rhs)
{
    return !(lhs == rhs);
}

bool operator<(const String &lhs, const string &rhs)
{
    return strcmp(lhs.str, rhs.str) < 0; 
}

bool operator<=(const String &lhs, const string &rhs)
{
    return strcmp(lhs.str, rhs.str) <= 0;
}

bool operator>(const String &lhs, const string &rhs)
{
    return strcmp(lhs.str, rhs.str) > 0; 
}
bool operator>=(const String &lhs, const string &rhs)
{
    return strcmp(lhs.str, rhs.str) >= 0; 
}
#endif

